<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数式组件</title>
    <script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script>
    <script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script>
    <script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
</head>

<body>
    <div id="root"></div>
    <script type="text/babel">
        // 作为组建的方法 使用大驼峰
        function HelloWorld() {
            return <h1>后端码匠</h1>
        }


        ReactDOM.render(
            HelloWorld(),
            document.getElementById('root')
        );

        // 语法糖
        ReactDOM.render(
            <HelloWorld />,
            document.getElementById('root')
        );
        // render(): 非新增是覆盖效果

        // 复用性
        let more = (
            <div>
                <HelloWorld />
                <HelloWorld />
                <HelloWorld />
                <HelloWorld />
                <HelloWorld />
                <HelloWorld />
            </div>
        )

        ReactDOM.render(more, document.getElementById('root'))

    </script>
</body>

</html>